import axios from "axios"
let http = axios.create({
    baseURL:"/api",
    timeout:10000
})


http.interceptors.request.use((config)=>{
    
    config.headers.authorization = sessionStorage.getItem("token")

    return config
})

http.interceptors.response.use((config)=>{

    if(config.data.state){
        return config
    }else{
        return new Promise.reject(config.data.msg)
        // return "村务"
    }
    
})

export default http